package com.kod.util;

import java.util.ArrayList;

import android.app.Activity;

import com.kod.GameApplication;

public class UtilLib {
	public static void exit() {
		for (Activity ac : GameApplication.allActivity) {
			ac.finish();
		}
		android.os.Process.killProcess(android.os.Process.myPid());
	}

	public static  String replace(String str) {
		ArrayList<String> list2 = new ArrayList<String>();
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < str.length(); i++) {
			char s = str.charAt(i);
			if (!list.contains(s + "")) {
				list.add(s + "");
			} else {
				list2.add(s + "");
			}
		}
		for (String key : list2) {
			int index = str.indexOf(key);
			String tmp =str.substring(index,str.length());
			tmp = tmp.replace(key, "");
			str =str.substring(0,index+1)+tmp;
		}
		return str;
	}
}
